﻿@model dynamic

@{
    ViewBag.Title = "Load Mobile Version";
    var pickingFolder = new DirectoryInfo(Server.MapPath(@"\Downloads\OrderPicking"));
    var driveFolder = new DirectoryInfo(Server.MapPath(@"\Downloads\DriverApp"));
    var lastestPicking = pickingFolder.GetDirectories().OrderByDescending(p => p.Name).FirstOrDefault();
    var lastestDriver = driveFolder.GetDirectories().OrderByDescending(p => p.Name).FirstOrDefault();
    var lastestPickingFile = lastestPicking.GetFiles().FirstOrDefault();
    var lastestDriverFile = lastestDriver.GetFiles().FirstOrDefault();
    
    }
<div class="container-fluid">
    <div class="page-header">
    </div>
    <div class="row-fluid">
        <div class="span12">
            <div class="box">
                <div class="box-title">
                    <h3><i class="icon-reorder"></i>Load Mobile Downloads</h3>
                </div>
                <div class="box-content">
    <h3>Latest version</h3>
    <ul>
        <li><b>Picking app @lastestPicking.Name:</b> <a href="/@lastestPickingFile.FullName.Replace(Server.MapPath(@"/"),"")">Downloads</a>

        </li>
        
        <li><b>Driver app @lastestDriver.Name:</b> <a href="/@lastestDriverFile.FullName.Replace(Server.MapPath(@"/"),"")">Downloads</a>

        </li>
    </ul>
    <p>
        <h3>Picking app History</h3>
        @Html.Raw(ViewBag.PickApp.Value)
</p>
    <ul>
       
            @foreach (var folder in pickingFolder.GetDirectories().OrderByDescending(p => p.Name))
            { 
             var i = 0;
            <li><b>@(folder.CreationTime +"("+@folder.Name+")"):</b><br>
                                                                <ol>
                                                                    
                                                                    @foreach (var file in folder.GetFiles())
                                                                    {
                                                                        i++;
                                                                        <li>Update @i : <a href="/@file.FullName.Replace(Server.MapPath(@"/"),"")"> @file.Name</a></li>
                                                                    }
                                                                </ol>
            </li> 
            }
       
    </ul>
                    <h3>Driver app History</h3>
         @Html.Raw(ViewBag.DriverApp.Value)
 <ul>
       
            @foreach(var folder in driveFolder.GetDirectories().OrderByDescending(p=>p.Name))
            { 
             var i = 0;
            <li><b>@(folder.CreationTime +"("+@folder.Name+")"):</b><br>
                                                                <ol>
                                                                    
                                                                    @foreach (var file in folder.GetFiles())
                                                                    {
                                                                        i++;
                                                                        <li>Update @i : <a href="/@file.FullName.Replace(Server.MapPath(@"/"),"")"> @file.Name</a></li>
                                                                    }
                                                                </ol>
            </li> 
            }
       
    </ul>

                </div>
            </div>
        </div>
    </div>
</div>